home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6404 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: news1.h1.usa.pipeline.com!usenet
  2. From: grantp@usa.pipeline.com(Pete)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: LPCREATESTRUCT
  5. Date: 7 Feb 1996 23:34:09 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4fbcth$6et@news1.usa.pipeline.com>
  8. NNTP-Posting-Host: pipe2.h1.usa.pipeline.com
  9. X-PipeUser: grantp
  10. X-PipeHub: usa.pipeline.com
  11. X-PipeGCOS: (Pete)
  12. X-Newsreader: Pipeline USA v3.3.0
  13.  
  14. On Feb 07, 1996 14:13:43 in article <LPCREATESTRUCT>, 'chris@sound.net
  15. (chris)' wrote: 
  16.  
  17.  
  18. >I am unable to determine what lpcreatestruct in doing in the following 
  19. >line of code.  It is in a windows procedure, within the code that is 
  20. >executed during the processing of the wm_create message. 
  21. >hInstance = ((LPCRETESTRUCT) lParam) -> hInstance; 
  22. >If you can point me in the right direction, I would appreciate it. 
  23. >Also, do you know where I might find this in the online documentation 
  24. >for the Borland Compiler (version 4.2). 
  25. Chances are that you ran into this on a function that responds 
  26. to a Windows message.  The standard Windows response -- or 
  27. callback -- function has the prototype: 
  28.  
  29.    int CALLBACK foo(HWND hWnd, WPARAM wp, LPARAM lParam); 
  30.  
  31. Certain Windows messages; e.g., WM_NCCREATE, receive a pointer 
  32. to a structure that provides extra parameters to the response functions. 
  33. In such cases, the message response function must cast the lParam 
  34. variable (defined as long) into a pointer to a pointer to the structure. 
  35. Windows.h defines (in its typical fashion): 
  36.  
  37. typedef CREATESTRUCT FAR * LPCREATESTRUCT; 
  38.  
  39. One of the slots in CREATESTRUCT is the handle to the parent 
  40. process instance; hInstance.  So, the gist of the line you 
  41. asked about is that the callee is extracting the instance handle 
  42. from the structure passed as the third parameter of the Windows 
  43. callback function. 
  44.  
  45. If you've never done any raw Windows API programming, this 
  46. "explanation" probably served only to confuse rather than 
  47. clarify.  Oh well, such is life. 
  48.  
  49. -- 
  50. Pete Grant 
  51. Kalevi, Inc. 
  52. Object Oriented Software Development 
  53. ... and raw Windows API too!  But 32-bit only:-)
  54.